<include file="Public:header" /> <include file="Public:navgation" />
<div class="container-fluid main-content">
    <div class="page-title chart-container"> </div>
    <div class="row">
        <div class="col-md-12">
            <div class="widget-container">
                <div class="heading"> 
                    <i class="icon-bar-chart"></i>草稿 
                    <a class="btn btn-default btn pull-right" data-toggle="modal" href="#myModal2" >筛选</a> 
                    <if condition="getAccessMenu($accessList, 'Intesys', 'Info_draft', 'insert')">
                        <a class="btn btn-primary btn pull-right f-fillwidth" data-toggle="modal" href="#myModal">创建草稿</a> 
                    </if>
                </div>
                <div class="widget-content padded modal-open">
                    <table id="datatable-editable" class="table table-striped table-bordered dataTable">
                        <thead>
                            <tr>
                                <th>标题</th>
                                <th class="hidden-xs">时间</th>
                                <th class="hidden-xs hidden-sm hidden-md">内容</th>
                                <th></th>
                            </tr>
                        </thead>
                        <volist name="list" id="vo" empty="$empty">
                            <tr class="data_list {$key}">
                                <td>{$vo.title}</td>
                                <td class=" hidden-xs">{:date('Y-m-d',$vo['datetime'])}</td>
                                <td class="hidden-xs hidden-sm hidden-md">{$vo.content}</td>
                                <td class="text-center actions">
                                    <a class="table-actions fancybox look" href="#fancybox"><i class="icon-eye-open"></i></a>  
                                    <if condition="getAccessMenu($accessList, 'Intesys', 'Info_draft', 'update')">
                                        <a class="table-actions update" href="{:U('update',array('id'=>$vo['id']))}"><i class="icon-pencil"></i></a>
                                    </if>
                                    <if condition="getAccessMenu($accessList, 'Intesys', 'Info_draft', 'delete')">
                                        <a class="table-actions delete-row text-danger" href="{:U('delete',array('id'=>$vo['id']))}" row="{$key}"><i class="icon-trash"></i></a>
                                    </if>
                                </td>
                            </tr>
                        </volist>
                    </table>
                    <!--modal start-->
                    <div class="modal fade" id="myModal3" style="display: none;" aria-hidden="true">
                        <div class="modal-dialog modal-lg">
                            <div class="modal-content">
                                <form method="post" name="formupdate" id="validate-form" class="form-horizontal" novalidate action="__URL__/update">
                                    <div class="modal-header">
                                        <button aria-hidden="true" class="close" data-dismiss="modal" type="button">×</button>
                                        <h4 class="modal-title">修改</h4>
                                    </div>
                                    <div class="modal-body">
                                        <fieldset>
                                            <div class="form-group">
                                                <label class="control-label col-sm-2">标题</label>
                                                <div class="col-sm-10">
                                                    <input value="" class="form-control" name="title" type="text" datatype="*">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <!--<label class="control-label col-sm-2">内容</label>-->
                                                <div class="col-sm-12">
                                                    <html:editor id="editorr" name="content" type="UEDIT" style="height:300px; width:100%;"></html:editor>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="control-label col-sm-2">类型</label>
                                                <div  class="col-sm-10">
                                                    <select class="form-control infotype" name="type">
                                                        <option value="0">草稿</option>
                                                        <if condition="getAccessMenu($accessList, 'Intesys', 'Info_approval', 'insert')">
                                                            <option value="approval">审批</option>
                                                        </if>
                                                        <if condition="getAccessMenu($accessList, 'Intesys', 'Info_remind', 'insert')">
                                                            <option value="remind">提醒</option>
                                                        </if>
                                                        <if condition="getAccessMenu($accessList, 'Intesys', 'Info_notice', 'insert')">
                                                            <option value="notice">公告</option>
                                                        </if>
                                                        <if condition="getAccessMenu($accessList, 'Intesys', 'Info_log', 'insert')">
                                                            <option value="log">日志</option>
                                                        </if>
                                                        <if condition="getAccessMenu($accessList, 'Intesys', 'Info_plan', 'insert')">
                                                            <option value="plan">计划</option>
                                                        </if>
                                                        <if condition="getAccessMenu($accessList, 'Intesys', 'Info_share', 'insert')">
                                                            <option value="share">分享</option>
                                                        </if>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group timefield" style="display:none">
                                                <label class="control-label col-sm-2">日期范围</label>
                                                <div class="col-sm-5" style="z-index:1050;">
                                                  <div class="input-group date datepicker" data-date-autoclose="true" data-date-format="dd-mm-yyyy">
                                                    <input placeholder="开始时间" name="starttime" class="form-control" type="text"><span class="input-group-addon"><i class="icon-calendar"></i></span>
                                                  </div>
                                                </div>
                                                <div class="col-sm-5" style="z-index:1050;">
                                                  <div class="input-group date datepicker" data-date-autoclose="true" data-date-format="dd-mm-yyyy">
                                                    <input placeholder="结束时间" name="endtime" class="form-control" type="text"><span class="input-group-addon"><i class="icon-calendar"></i></span>
                                                  </div>
                                                </div>
                                            </div>
                                        </fieldset>
                                    </div>
                                    <div class="modal-footer">
                                        <button class="btn btn-primary" type="submit">修改</button>
                                        <button class="btn btn-default-outline" data-dismiss="modal" type="button">关闭</button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    <!--modal start-->
                    <div class="modal fade" id="myModal" style="display: none;" aria-hidden="true">
                        <div class="modal-dialog modal-lg">
                            <div class="modal-content">
                                <form method="post" name="form" id="validate-form" class="form-horizontal" novalidate action="__URL__/insert">
                                    <div class="modal-header">
                                        <button aria-hidden="true" class="close" data-dismiss="modal" type="button">×</button>
                                        <h4 class="modal-title">创建</h4>
                                    </div>
                                    <div class="modal-body">
                                        <fieldset>
                                            <div class="form-group">
                                                <label class="control-label col-sm-2">标题</label>
                                                <div class="col-sm-10">
                                                    <input value="" class="form-control" name="title" type="text" datatype="*">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <!--<label class="control-label col-sm-2">内容</label>-->
                                                <div class="col-sm-12">
                                                    <html:editor id="editor" name="content" type="UEDIT" style="height:300px; width:100%;"></html:editor>
                                                </div>
                                            </div>
                                        </fieldset>
                                    </div>
                                    <div class="modal-footer">
                                        <button class="btn btn-primary" type="submit">确定</button>
                                        <button class="btn btn-default-outline" data-dismiss="modal" type="button">关闭</button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    <!-- modal end and modal2 start-->
                    <div class="modal fade" id="myModal2" style="display: none;" aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <form method="post" name="form" id="validate-form" class="form-horizontal" novalidate action="__URL__/index">
                                    <div class="modal-header">
                                        <button aria-hidden="true" class="close" data-dismiss="modal" type="button">×</button>
                                        <h4 class="modal-title">规则筛选</h4>
                                    </div>
                                    <div class="modal-body">
                                        <fieldset>
                                            <div class="row">
                                            <div class="form-group">
                                                <label class="control-label col-sm-2">日期范围</label>
                                                <div class="col-sm-5" style="z-index:1050;">
                                                  <div class="input-group date datepicker" data-date-autoclose="true" data-date-format="dd-mm-yyyy">
                                                    <input placeholder="开始时间" name="starttime" class="form-control" type="text"><span class="input-group-addon"><i class="icon-calendar"></i></span>
                                                  </div>
                                                </div>
                                                <div class="col-sm-5" style="z-index:1050;">
                                                  <div class="input-group date datepicker" data-date-autoclose="true" data-date-format="dd-mm-yyyy">
                                                    <input placeholder="结束时间" name="endtime" class="form-control" type="text"><span class="input-group-addon"><i class="icon-calendar"></i></span>
                                                  </div>
                                                </div>
                                            </div>
                                            </div>
                                        </fieldset>
                                    </div>
                                    <div class="modal-footer">
                                        <button class="btn btn-primary" type="submit">筛选</button>
                                        <button class="btn btn-default-outline" data-dismiss="modal" type="button">关闭</button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    <!-- modal end and fancybox1 start-->
                    <div id="fancybox" style="display: none;">
                        <h4 class="text-muted">查看</h4>
                        <ul class="no-style"></ul>
                    </div>
                    <!-- fancybox1 end and fancybox1 start-->
                    <div id="fancybox1" style="display: none;">
                        <ul class="nav nav-tabs" role="tablist">
                            <foreach name="memberlist" item="vo">
                                <li role="presentation"><a href="#{$key}" aria-controls="{$key}" role="tab" data-toggle="tab">{$key}</a></li>
                            </foreach>
                        </ul>
                        
                        <!-- Tab panes -->
                        <div class="tab-content" style="min-height:160px">
                        <foreach name="memberlist" item="vo">
                            <div role="tabpanel" class="tab-pane" id="{$key}">
                                <foreach name="vo" item="ko">
                                    <label class="checkbox-inline"><input name="staff" type="checkbox" value="{$ko.id}"><span>{$ko.nickname}</span></label>
                                </foreach>
                            </div>
                        </foreach>
                        </div>
                        <div class="col-xs-12">
                            <button class="btn btn-primary btn-md pull-right getstaff">确定</button>
                        </div>
                    </div>
                    <!-- fancybox1 end -->
                </div>
            </div>
        </div>
    </div>
</div>
<script>
$(".update").click(function(e) {
    e.preventDefault();
    $("#myModal3 form").attr("action",$(this).attr("href"));
    $("#myModal3 .form-group").find('[name="title"]').val($(this).parents(".data_list").find("td:eq(0)").html());
    $("#myModal3 .form-group  #editorr #ueditor_0").contents().find("body p").html($(this).parents(".data_list").find("td:eq(2)").html());
    $("#myModal3").modal("show");
    return false;
});
$(".infotype").change(function(e) {
    $(this).parents("fieldset").find(".timefield").css("display","none");
    $(this).parents("fieldset").find(".stafffield").remove();
    if($(this).val()=='plan'){
        $(this).parents("fieldset").find(".timefield").css("display","block");   
    }
    if($(this).val()=='share'||$(this).val()=='log'||$(this).val()=='remind'){
        $(this).parents("fieldset").append('<div class="form-group stafffield"><label class="control-label col-sm-2">选择员工</label><div class="col-sm-10"><div class="input-group"><input readonly name="pid"  class="form-control" type="text"><span class="input-group-btn"><button class="btn btn-default fancybox1" href="#fancybox1" type="button">选择</button></span></div></div></div>');    
    }
}); 
</script> 
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script> 
<include file="Public:footer" />